<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function father(name) {
            this.name = name
        }
        father.prototype.sayname = function(){
            return this.name
        } 

        function son(name,age) {
            this.age = age
            father.call(this, name)
        }

        function inherit(son, father) {
            let newFather = Object.create(father.prototype)
            son.prototype = newFather;
            son.prototype.constructor = son
        }
        inherit(son, father)

        son.prototype.sayage = function(){
            return this.age
        }

        let son1 = new son("jiao",27)
        console.dir(son1)
        console.log(son1.sayage())
        console.log(son1.sayname())
    </script>
</body>

</html>